package com.sysware;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/SaveDataServlet")
public class SaveDataServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private static String STATIC_STRING = "";

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		if ("save".equals(request.getParameter("type"))) {
			STATIC_STRING = request.getParameter("STATIC_STRING");
		} else {
			response.setCharacterEncoding("UTF-8");
			response.getWriter().write(STATIC_STRING);
		}

	}

}
